<?php

/**
 * @author ducnhat
 * @email ddnhat@gmail.com
 * @copyright 2014
 */

class Zenddn_Mail_Mail extends Zend_Mail{
	
	private function _send($email, $name, $subject, $content, $from = "no-reply@dietvirut.com"){
	    $config = array('auth' => 'login', 'username' => 'no-reply@dietvirut.com', 'password' => 'festival', 'ssl' => 'ssl', 'port' => 465 );
        $host = 'misrv20.fastcpanelserver.com';
        $tr = new Zend_Mail_Transport_Smtp($host, $config);
        Zend_Mail::setDefaultTransport($tr);
        
        $mail = new Zend_Mail('UTF-8');
        $mail->addTo($email, $name);
        $mail->setSubject($subject);
        $mail->setFrom($from, "Dietvirut.com");
        $mail->setBodyHtml($content, 'utf-8');
        
        $mail->send();
	}
    
    public function sendActivationCode($email, $name, $content){
        $subject = "Kích hoạt tài khoản tại Dietvirut.com";
        
        $this->_send($email, $name, $subject, $content);
    }
    
    public function sendResetPasswordCode($email, $name, $content){
        $subject = "Thay đổi mật khẩu tài khoản tại Dietvirut.com";
        
        $this->_send($email, $name, $subject, $content);
    }
    
    public function sendProductKey($email, $name, $content){
        $subject = "Mua hàng thành công tại Dietvirut.com";
        
        $this->_send($email, $name, $subject, $content);
    }
}